#ifndef __STDMYSTRING_H_
#define __STDMYSTRING_H_
#include <iostream>
class MyStringList;
class StdMyString
{

public:
    StdMyString();
    StdMyString(const char *str);
    StdMyString(const StdMyString &str);
    ~StdMyString();
    StdMyString& operator=(const StdMyString &str);
    StdMyString  operator+(const StdMyString&str);
    StdMyString& operator+=(const StdMyString&str);
    StdMyString& operator-=(const StdMyString&str);
    StdMyString  operator-(const StdMyString&str);
    char& operator[](int index);
    StdMyString& operator+=(const char&str);
    //逻辑运算符
    bool operator==(const StdMyString &str);
    bool operator>(const StdMyString &str);
    bool operator<(const StdMyString &str);
    // bool operator&&(const StdMyString &str);


    friend std::istream &operator>>(std::istream &is,  StdMyString &str);
    friend std::ostream &operator<<(std::ostream &os, const StdMyString &str);
    
    operator int();
    operator double();
    //字符串切割
    MyStringList  split(const StdMyString&str);
private:
    char *string;
    int size;
    int capacity;
};

std::ostream &operator<<(std::ostream &os, const StdMyString &str);
std::istream &operator>>(std::istream &os,  StdMyString &str);

class MyStringList
{   public:
    MyStringList(int capacity=15);
    MyStringList& operator +=(const StdMyString&str);
    MyStringList& operator <<(const StdMyString&str);

    MyStringList operator+(const MyStringList&list);
    MyStringList operator-=(const MyStringList&list);


    //拷贝构造 赋值运算
    // - -= == > < [] >>

    ~MyStringList();
    friend  std::ostream& operator <<(std::ostream&os,const MyStringList&list);
    private:
        StdMyString *array;
        int size;
        int capacity;
};

std::ostream& operator <<(std::ostream&os,const MyStringList&list);


#endif